{% extends "base.html" %}
<!-- Replace the TITLE of template base.html -->
{% block title %}JltxSeo's Blog{% endblock %}

{% block stylesheets %}
  {{ super() }}
{% endblock stylesheets %}

<!-- Replace the BODY of template base.html -->
{% block body %}
    <!-- The data object from view function: `blog()` -->
    <div class="row">
        <div class="col-lg-9">
            <h3>文章列表</h3>
            {% for post in posts.items %}
                <div class="row">
                    <div class="col-lg-12">
                        <h1>{{ post.title }}</h1>
                    </div>
                </div>

                <div class="row">
                    <div class="col-lg-12">
                        {{ post.text | truncate(255) | safe }}
                        <a href="{{ url_for('blog_blueprint.post', post_id=post.id) }}">阅读更多</a>
                    </div>
                </div>
            {% endfor %}
        </div>

        <div class="col-lg-3">
            <div class="row">
                <h5>最新文章</h5>
                <ul>
                    {% for post in recent %}
                        <li><a href="{{ url_for('blog_blueprint.post', post_id=post.id) }}">{{ post.title }}</a></li>
                    {% endfor %}
                </ul>
            </div>

            <div class="row">
                <h5>热门标签</h5>
                <ul>
                    {% for tag in top_tags %}
                        <li><a href="{{ url_for('blog_blueprint.tag', tag_name=tag[0].name) }}">{{ tag[0].name }}</a></li>
                    {% endfor %}
                </ul>
            </div>
        </div>
    </div>
    <!-- Call the Macro: `render_pagination` from base.html -->
    {{ render_pagination(posts, 'blog_blueprint.home') }}
{% endblock body%}